<script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/upload/ajaxfileupload.js"></script>
<link rel="stylesheet" href="<?php echo URLPRE;?>static/public/Lib/upload/ajaxfileupload.css" />
<div id=uploadfile class="J_lmenu dialog_content">
<table class="list" cellpadding="0" cellspacing="1" border="0">
	<tbody>
		<tr class="even">
			<td class="name" width="150"><label class="validation">上传图片：</label></td>
			<td style="width:300px;"><input id="fileToUpload" type="file" name="filename" size="15" class="input" /><input id="upload_btn" type="button" class="btn" value="上传" />
			<div class="files"></div>	
			<div style="clear:both"></div>		
			</td>
			<td class="field"></td>
		</tr>
	</tbody>
</table>
</div>
<script type="text/javascript">
$(document).ready(function() {	
	//点击上传按钮
	$('#upload_btn').click(function(){
		ajaxFileUpload();
	});	
});
function ajaxFileUpload(){
	$.ajaxFileUpload({
		url:'<?php echo $ajax_upload_url;?>',
		secureuri:false,
		fileElementId:'fileToUpload',
		dataType: 'json',
		success: function(data, status){
			if(data.error!=''){
				alert(data.msg);
			}else{
				$(".files").html("<div style='float:left;padding-right:10px;'>"+data.name+"("+data.size+")<span class='delimg' rel='"+data.new_name+"'>删除</span><input type='hidden' id='source_img' value='"+data.source_img+"' /><input type='hidden' id='info_image' value='"+data.info_image+"' /><input type='hidden' id='thumb_image' value='"+data.thumb_image+"'/></div>");
			}
		},
		error: function(data, status, e){
			alert(e);
		}
	});
	return false;	
}
</script>